package com.itheima.controller;

import com.itheima.entity.CountOption;
import com.itheima.entity.DegreeOption;
import com.itheima.entity.JobOption;
import com.itheima.entity.Result;
import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;

    /**
     * 统计各个职位的员工人数
     * @return
     */
    @GetMapping("/empJobData")
    public Result getEmpJobData(){
        log.info("统计各个职位的员工人数");
        JobOption jobOption = reportService.getEmpJobData();
        return Result.success(jobOption);
    }

    @GetMapping("/empGenderData")
    public Result getEmpGenderData(){
        log.info("统计员工性别分布数据");
        List<Map> genderList = reportService.getEmpGenderData();
        return Result.success(genderList);
    }

    @GetMapping("/studentCountData")
    public Result getStudentCountData(){
        log.info(" 班级人数统计");
        CountOption countOption = reportService.getStudentCountData();
        return Result.success(countOption);
    }

    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData(){
        log.info("统计班级学位分布数据");
//        DegreeOption degreeOption = reportService.getStudentDegreeData();
        List<Map> degreeList = reportService.getStudentDegreeData();
        return Result.success(degreeList);
    }

}
